package com.yqd.d4_polymorphism.demo2;

public class Master {
    public void feed(Pet pet) {
        pet.eat();
    }

    public void play(Pet pet) {
        if (pet instanceof Cat) {
            ((Cat) pet).playBall();
        } else if (pet instanceof Dog) {
            ((Dog) pet).playDisk();
        }
    }
}
